package view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;


@SuppressWarnings("serial")
public class MainPanel extends JPanel {
	private static final int HEIGHT_PANEL = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() * 0.75);
	private static final int WIDTH_PANEL = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() * 0.75);
	private static final int SIZE_THUMBNAIL = (int) (HEIGHT_PANEL * 0.15);
	private static final int SIZE_VIEW = (int) (HEIGHT_PANEL * 0.50);

	
	public MainPanel(Thumbnail thumbnail, ImagePanel firstView, ImagePanel secondView, JFrame frame) {
		
		setLayout(new GridBagLayout());
		GridBagConstraints grid = new GridBagConstraints();
		this.setSize(WIDTH_PANEL, HEIGHT_PANEL);
		
		thumbnail.setBorder(BorderFactory.createTitledBorder("Thumbnail"));
		firstView.setBorder(BorderFactory.createTitledBorder("View #1"));
		secondView.setBorder(BorderFactory.createTitledBorder("View #2"));
		
		
		thumbnail.setPreferredSize(new Dimension(SIZE_THUMBNAIL, SIZE_THUMBNAIL));
		firstView.setPreferredSize(new Dimension(SIZE_VIEW, SIZE_VIEW));
		secondView.setPreferredSize(new Dimension(SIZE_VIEW, SIZE_VIEW));
		
		
		thumbnail.setBackground(Color.lightGray);
		firstView.setBackground(Color.lightGray);
		secondView.setBackground(Color.lightGray);
		
		grid.gridx = 0;
		grid.gridy = 0;
		grid.fill = GridBagConstraints.HORIZONTAL;
		add(firstView, grid);
		grid.gridy = 1;
		grid.anchor = GridBagConstraints.LAST_LINE_START;
		grid.fill = GridBagConstraints.NONE;
		add(thumbnail, grid);
		grid.gridx = 1;
		grid.fill = GridBagConstraints.HORIZONTAL;
		add(secondView, grid);
		
	}
	
}